<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <link href="../css/swiper.min.css" rel="stylesheet"/>
    <style>
    .layui-laydate{
      width: 100%!important;
    }.layui-laydate-main{
      width: 100%!important;
    }
    .layui-laydate-content table{
      width: 100%!important;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">班组会</div>
      </div>
      <!--  -->
      <!--  -->
      <div class="x-trtali-box" id="calali" style="margin:1rem"></div>
      <!--  -->
      <div class="x-workforce-tabs swiper-container" style="margin:1rem">
        <div class="swiper-wrapper">
          <div class="swiper-slide x-workforce-items" v-for="(item,index) in formheaderdata" :key="item.id" @click="changetab(index,item.id)" :class="{active:curId==index}">{{item.title}}</div>
        </div>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-inc-num">检查项目</div>
        <template>
          <el-table :data="tableData">
            <el-table-column label="序号" width="50" type="index" fixed></el-table-column>
            <el-table-column label="检查项目" width="" fixed>
              <template slot-scope="scope">
                {{scope.row.title}}
              </template>
            </el-table-column>
            <el-table-column label="检查结果" width="">
              <template slot-scope="scope">
                <div v-if="scope.row.is_ok=='0'" size="mini">未确认</div>
                <div v-if="scope.row.is_ok=='1'" size="mini" class="x-text-g">已完成</div>
                <div v-if="scope.row.is_ok=='2'" size="mini" class="x-text-r">未完成</div>
              </template>
            </el-table-column>
            <el-table-column label="记录要点" width="">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="editfavo(scope.row.title,scope.row.content)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-inc-num">总结项目</div>
        <div class="x-pro-list" v-for="item in summarydata" :key="item.key">
          <div class="x-pro-top">{{item.title}}</div>
          <div class="x-pro-desc">
            <div class="x-pmo-de">{{item.content}}</div>
          </div>
        </div>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-inc-num">改善计划</div>
        <template>
          <el-table :data="tablechange">
            <el-table-column label="改善计划" width="">
              <template slot-scope="scope">
                {{scope.row.content}}
              </template>
            </el-table-column>
            <el-table-column label="达成结果" width="">
              <template slot-scope="scope">
                {{scope.row.improve}}
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-inc-num">发布公告</div>
        <div class="x-pro-row">
          <div class="x-pro-input">
            <el-input placeholder="请输入内容" v-model="sendask" type="textarea" :rows="4" :disabled="isfromindex"></el-input>
          </div>
        </div>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-inc-num">今日训练内容</div>
        <template>
          <el-table :data="tabletoday">
            <el-table-column label="受训人" width="" fixed>
              <template slot-scope="scope">
                {{scope.row.username}}
              </template>
            </el-table-column>
            <el-table-column label="学习工作站" width="">
              <template slot-scope="scope">
                {{scope.row.ws_title}}
              </template>
            </el-table-column>
            <el-table-column label="学习内容" width="">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="editfavo(scope.row.username,scope.row.content)">查看</el-button>
              </template>
            </el-table-column>
            <el-table-column label="带训周期" width="">
              <template slot-scope="scope">
                {{scope.row.date1}}-{{scope.row.date2}}
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
      <!--  -->
      <el-dialog :title="toasttitle" :visible.sync="edittoast" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <span>{{toastcon}}</span>
      </el-dialog>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
  <script type="text/javascript" src="../script/swiper.min.js"></script>
  <script type="text/javascript" src="../script/laydate/laydate.js"></script>
	<script>
apiready = function () {
    $api.fixStatusBar($api.byId('header'));


    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          thmonth:'',
          formheaderdata:'',
          curId:0,
          activeName: 'first',
          tableData:[],
          workall:'',
          sendask:'',
          edittoast:false,
          textvalue:'',
          input4:'',
          tabsid:'',
          toasttitle:'',
          toastcon:'',
          isfromindex:true,
          summarydata:'',
          tabletoday:[],
          tablechange:[],

        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;
        laydate.render({
          elem: '#calali',
          position: 'static',
          btns:['now'],
          format:'yyyyMMdd',
          // theme:'#058142',
          change:function(value,date){
            console.log(value);
            that.thmonth = value;
            that.getdata()
          }
        });
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var day = date.getDate()
        if(month<10){
          month = '' + 0 + month;
        }
        if(day<10){
          day = '' + 0 + day;
        }
        var toMonth = '' + year +  month +  day;
        that.thmonth = toMonth;
        that.getdata()

      },
      methods: {
        //记录要点
        editfavo:function(title,content){
          var that = this;
          that.toasttitle = title;
          that.toastcon = content;
          that.edittoast = true;
        },
        //
        getdata:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/team/view',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                cateid:that.tabsid,
                date:that.thmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                  that.formheaderdata = ret.data.cate;
                  that.tableData = ret.data.check;
                  that.summarydata = ret.data.summary;
                  that.sendask = ret.data.notice.content;
                  that.tabletoday = ret.data.task;//今日训练内容
                  that.tablechange = ret.data.gsjh;//改善计划
                  // that.workall = ;
                  // that.sendask = ;
                  var nunum;
                  if(that.formheaderdata.length<3){
                    nunum = 2;
                  }else{
                    nunum = 3;
                  }
                  that.$nextTick(function(){
                    var mySwiper = new Swiper('.swiper-container',{
                      freeMode: true,
                      loop:false,//设置 active slide 居中后，会有左右留白现象，添加此会让未尾的导航补齐前后空白
                      slideToClickedSlide: true,//设置为true则点击slide会过渡到这个slide。
                      slidesPerView: nunum,
                      centeredSlides: false,//设定为true时，active slide会居中，而不是默认状态下的居左。
                      spaceBetween: 10,//slide之间设置距离
                      slidesOffsetBefore: 0,//设定slide与左边框的预设偏移量
                      slidesOffsetAfter: 0,//设定slide与右边框的预设偏移量

                    });

                  });
              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //切换选项卡 表格数据
        changetab:function(index,id){
          var that = this;
          that.curId = index;
          that.tabsid = id;
          that.getdata()
        },
      }
    })
	}


	</script>
</body>
</html>
